Integrand size = 41, antiderivative size = 91 \[ \int \frac {(a+i a \tan (e+f x))^2 (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^2} \, dx=-\frac {i a^2 B x}{c^2}-\frac {a^2 B \log (\cos (e+f x))}{c^2 f}+\frac {a^2 (i A+B)}{c^2 f (i+\tan (e+f x))^2}-\frac {a^2 (A-3 i B)}{c^2 f (i+\tan (e+f x))} \]
-I*a^2*B*x/c^2-a^2*B*ln(cos(f*x+e))/c^2/f+a^2*(I*A+B)/c^2/f/(I+tan(f*x+e)) ^2-a^2*(A-3*I*B)/c^2/f/(I+tan(f*x+e))
Time = 4.53 (sec) , antiderivative size = 56, normalized size of antiderivative = 0.62 \[ \int \frac {(a+i a \tan (e+f x))^2 (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^2} \, dx=\frac {a^2 \left (B \log (i+\tan (e+f x))-\frac {2 B+(A-3 i B) \tan (e+f x)}{(i+\tan (e+f x))^2}\right )}{c^2 f} \]
(a^2*(B*Log[I + Tan[e + f*x]] - (2*B + (A - (3*I)*B)*Tan[e + f*x])/(I + Ta n[e + f*x])^2))/(c^2*f)
Time = 0.32 (sec) , antiderivative size = 65, normalized size of antiderivative = 0.71, number of steps used = 6, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.122, Rules used = {3042, 4071, 27, 86, 2009}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int \frac {(a+i a \tan (e+f x))^2 (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^2} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {(a+i a \tan (e+f x))^2 (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^2}dx\) |
\(\Big \downarrow \) 4071 |
\(\displaystyle \frac {a c \int \frac {a (i \tan (e+f x)+1) (A+B \tan (e+f x))}{c^3 (1-i \tan (e+f x))^3}d\tan (e+f x)}{f}\) |
\(\Big \downarrow \) 27 |
\(\displaystyle \frac {a^2 \int \frac {(i \tan (e+f x)+1) (A+B \tan (e+f x))}{(1-i \tan (e+f x))^3}d\tan (e+f x)}{c^2 f}\) |
\(\Big \downarrow \) 86 |
\(\displaystyle \frac {a^2 \int \left (-\frac {2 i (A-i B)}{(\tan (e+f x)+i)^3}+\frac {B}{\tan (e+f x)+i}+\frac {A-3 i B}{(\tan (e+f x)+i)^2}\right )d\tan (e+f x)}{c^2 f}\) |
\(\Big \downarrow \) 2009 |
\(\displaystyle \frac {a^2 \left (-\frac {A-3 i B}{\tan (e+f x)+i}+\frac {B+i A}{(\tan (e+f x)+i)^2}+B \log (\tan (e+f x)+i)\right )}{c^2 f}\) |
(a^2*(B*Log[I + Tan[e + f*x]] + (I*A + B)/(I + Tan[e + f*x])^2 - (A - (3*I )*B)/(I + Tan[e + f*x])))/(c^2*f)
3.7.84.3.1 Defintions of rubi rules used
Int[(a_)*(Fx_), x_Symbol] :> Simp[a Int[Fx, x], x] /; FreeQ[a, x] && !Ma tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
Int[((a_.) + (b_.)*(x_))*((c_) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_ .), x_] :> Int[ExpandIntegrand[(a + b*x)*(c + d*x)^n*(e + f*x)^p, x], x] /; FreeQ[{a, b, c, d, e, f, n}, x] && ((ILtQ[n, 0] && ILtQ[p, 0]) || EqQ[p, 1 ] || (IGtQ[p, 0] && ( !IntegerQ[n] || LeQ[9*p + 5*(n + 2), 0] || GeQ[n + p + 1, 0] || (GeQ[n + p + 2, 0] && RationalQ[a, b, c, d, e, f]))))
Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Si mp[a*(c/f) Subst[Int[(a + b*x)^(m - 1)*(c + d*x)^(n - 1)*(A + B*x), x], x , Tan[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, A, B, m, n}, x] && EqQ[b*c + a*d, 0] && EqQ[a^2 + b^2, 0]
Time = 0.13 (sec) , antiderivative size = 103, normalized size of antiderivative = 1.13
method | result | size |
risch | \(-\frac {{\mathrm e}^{4 i \left (f x +e \right )} a^{2} B}{4 c^{2} f}-\frac {i {\mathrm e}^{4 i \left (f x +e \right )} A \,a^{2}}{4 c^{2} f}+\frac {B \,a^{2} {\mathrm e}^{2 i \left (f x +e \right )}}{c^{2} f}+\frac {2 i B \,a^{2} e}{c^{2} f}-\frac {B \,a^{2} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}{c^{2} f}\) | \(103\) |
derivativedivides | \(\frac {i a^{2} A}{f \,c^{2} \left (i+\tan \left (f x +e \right )\right )^{2}}+\frac {a^{2} B}{f \,c^{2} \left (i+\tan \left (f x +e \right )\right )^{2}}+\frac {3 i a^{2} B}{f \,c^{2} \left (i+\tan \left (f x +e \right )\right )}-\frac {a^{2} A}{f \,c^{2} \left (i+\tan \left (f x +e \right )\right )}+\frac {a^{2} B \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 f \,c^{2}}-\frac {i a^{2} B \arctan \left (\tan \left (f x +e \right )\right )}{f \,c^{2}}\) | \(138\) |
default | \(\frac {i a^{2} A}{f \,c^{2} \left (i+\tan \left (f x +e \right )\right )^{2}}+\frac {a^{2} B}{f \,c^{2} \left (i+\tan \left (f x +e \right )\right )^{2}}+\frac {3 i a^{2} B}{f \,c^{2} \left (i+\tan \left (f x +e \right )\right )}-\frac {a^{2} A}{f \,c^{2} \left (i+\tan \left (f x +e \right )\right )}+\frac {a^{2} B \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 f \,c^{2}}-\frac {i a^{2} B \arctan \left (\tan \left (f x +e \right )\right )}{f \,c^{2}}\) | \(138\) |
-1/4/c^2/f*exp(4*I*(f*x+e))*a^2*B-1/4*I/c^2/f*exp(4*I*(f*x+e))*A*a^2+B*a^2 /c^2/f*exp(2*I*(f*x+e))+2*I*B*a^2/c^2/f*e-B*a^2/c^2/f*ln(exp(2*I*(f*x+e))+ 1)
Time = 0.25 (sec) , antiderivative size = 62, normalized size of antiderivative = 0.68 \[ \int \frac {(a+i a \tan (e+f x))^2 (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^2} \, dx=\frac {{\left (-i \, A - B\right )} a^{2} e^{\left (4 i \, f x + 4 i \, e\right )} + 4 \, B a^{2} e^{\left (2 i \, f x + 2 i \, e\right )} - 4 \, B a^{2} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right )}{4 \, c^{2} f} \]
1/4*((-I*A - B)*a^2*e^(4*I*f*x + 4*I*e) + 4*B*a^2*e^(2*I*f*x + 2*I*e) - 4* B*a^2*log(e^(2*I*f*x + 2*I*e) + 1))/(c^2*f)
Time = 0.29 (sec) , antiderivative size = 160, normalized size of antiderivative = 1.76 \[ \int \frac {(a+i a \tan (e+f x))^2 (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^2} \, dx=- \frac {B a^{2} \log {\left (e^{2 i f x} + e^{- 2 i e} \right )}}{c^{2} f} + \begin {cases} \frac {4 B a^{2} c^{2} f e^{2 i e} e^{2 i f x} + \left (- i A a^{2} c^{2} f e^{4 i e} - B a^{2} c^{2} f e^{4 i e}\right ) e^{4 i f x}}{4 c^{4} f^{2}} & \text {for}\: c^{4} f^{2} \neq 0 \\\frac {x \left (A a^{2} e^{4 i e} - i B a^{2} e^{4 i e} + 2 i B a^{2} e^{2 i e}\right )}{c^{2}} & \text {otherwise} \end {cases} \]
-B*a**2*log(exp(2*I*f*x) + exp(-2*I*e))/(c**2*f) + Piecewise(((4*B*a**2*c* *2*f*exp(2*I*e)*exp(2*I*f*x) + (-I*A*a**2*c**2*f*exp(4*I*e) - B*a**2*c**2* f*exp(4*I*e))*exp(4*I*f*x))/(4*c**4*f**2), Ne(c**4*f**2, 0)), (x*(A*a**2*e xp(4*I*e) - I*B*a**2*exp(4*I*e) + 2*I*B*a**2*exp(2*I*e))/c**2, True))
Exception generated. \[ \int \frac {(a+i a \tan (e+f x))^2 (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^2} \, dx=\text {Exception raised: RuntimeError} \]
Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 191 vs. \(2 (81) = 162\).
Time = 0.54 (sec) , antiderivative size = 191, normalized size of antiderivative = 2.10 \[ \int \frac {(a+i a \tan (e+f x))^2 (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^2} \, dx=-\frac {\frac {6 \, B a^{2} \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 1\right )}{c^{2}} - \frac {12 \, B a^{2} \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + i\right )}{c^{2}} + \frac {6 \, B a^{2} \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 1\right )}{c^{2}} + \frac {25 \, B a^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{4} + 12 \, A a^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} + 112 i \, B a^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} - 198 \, B a^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - 12 \, A a^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 112 i \, B a^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 25 \, B a^{2}}{c^{2} {\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + i\right )}^{4}}}{6 \, f} \]
-1/6*(6*B*a^2*log(tan(1/2*f*x + 1/2*e) + 1)/c^2 - 12*B*a^2*log(tan(1/2*f*x + 1/2*e) + I)/c^2 + 6*B*a^2*log(tan(1/2*f*x + 1/2*e) - 1)/c^2 + (25*B*a^2 *tan(1/2*f*x + 1/2*e)^4 + 12*A*a^2*tan(1/2*f*x + 1/2*e)^3 + 112*I*B*a^2*ta n(1/2*f*x + 1/2*e)^3 - 198*B*a^2*tan(1/2*f*x + 1/2*e)^2 - 12*A*a^2*tan(1/2 *f*x + 1/2*e) - 112*I*B*a^2*tan(1/2*f*x + 1/2*e) + 25*B*a^2)/(c^2*(tan(1/2 *f*x + 1/2*e) + I)^4))/f
Time = 8.44 (sec) , antiderivative size = 104, normalized size of antiderivative = 1.14 \[ \int \frac {(a+i a \tan (e+f x))^2 (A+B \tan (e+f x))}{(c-i c \tan (e+f x))^2} \, dx=-\frac {a^2\,\left (B\,2{}\mathrm {i}+A\,\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}+3\,B\,\mathrm {tan}\left (e+f\,x\right )+B\,\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,1{}\mathrm {i}+2\,B\,\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,\mathrm {tan}\left (e+f\,x\right )-B\,\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,{\mathrm {tan}\left (e+f\,x\right )}^2\,1{}\mathrm {i}\right )\,1{}\mathrm {i}}{c^2\,f\,{\left (-1+\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}\right )}^2} \]